package com.neural.neighbourhood;


public enum NeighbourhoodManager {

	CROSS_NEIGHBOURHOOD("cross", new CrossNeighbourhood()),
	DIAGONAL_NEIGHBOURHOOD("diagonal", new DiagonalNeighbourhood()),
	DIAMOND_NEIGHBOURHOOD("diamond", new DiamondNeighbourhood()),
	SQUARE_NEIGHBOURHOOD("square", new SquareNeighbourhood()),
	X_NEIGHBOURHOOD("x", new XNeighbourhood()),
	Y_NEIGHBOURHOOD("y", new YNeighbourhood());

	private NeighbourhoodManager(String name, Neighbourhood neighbourhood) {
		this.name = name;
		this.neighbourhood = neighbourhood;
	}

	public static Neighbourhood getNeighbourhoodFromName(String name) {
		for (NeighbourhoodManager neighbourhoodManager : values()) {
			if (neighbourhoodManager.name.equals(name)) {
				return neighbourhoodManager.neighbourhood;
			}
		}
		return null;
	}

	private final String name;
	private final Neighbourhood neighbourhood;
}
